<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui"
                template="/WEB-INF/templates/general.xhtml">

        <ui:define name="title"><h:outputText value="Statistics" /></ui:define>
        
        <ui:define name="content">
        <h:form id="form">
		        	<p:growl id="growl" showDetail="false" sticky="false" autoUpdate="true" life="3000" />
        	<p:panel>
        		<p:tabView>

                    <p:tab id="categories" title="Categories">
                        <h2>Category statistics</h2>

                        <ui:repeat var="c" value="#{administrationBean.getMotherCategories()}">
                            <h3>#{c.name}</h3>
                            <p:dataTable value="#{c.subCategories}" var="c1" style="width: 500px;" styleClass="newTableHeader">
                                <p:column headerText="Product">
                                    #{c1.name}
                                </p:column>
                                <p:column headerText="pcs">
                                    #{statisticsBean.calculateCount(c1, 2014)}
                                </p:column>
                                <p:column headerText="with heating">

                                </p:column>
                            </p:dataTable>

                            <h:outputText value="total weight #{statisticsBean.calculateWeight(c, 2014)} kg"/>
                        </ui:repeat>

                    </p:tab>

        		</p:tabView>
			</p:panel>
        </h:form>
        </ui:define>
        
</ui:composition>